#include <netif/grethif.h>
#include <lwip/netif.h>

static struct ip_addr ipaddr, netmask, gw;
static struct netif netif;
/* Set network address variables */
static err_t 
ethinput (struct pbuf *p, struct netif *netif)
{
    pbuf_free(p);
    p=NULL;
    
    return ERR_OK;

}

 
int main(void)
{
    // Set Hardware address
    netif.hwaddr[0] = 0xAA;
    netif.hwaddr[1] = 0xAB;
    netif.hwaddr[2] = 0xAC;
    netif.hwaddr[3] = 0xAD;
    netif.hwaddr[4] = 0xAE;
    netif.hwaddr[5] = 0xAF;
    
    IP4_ADDR(&gw, 192,168,0,1);
    IP4_ADDR(&ipaddr, 192,168,0,5);
    IP4_ADDR(&netmask, 255,255,255,0);    
    netif_init();
    struct netif* pnetif = netif_add(&netif, &ipaddr, &netmask, &gw, NULL, &grethif_init, &ethinput);
    if(pnetif == NULL)
    {
        printf("pnetif null\n");
        return -1;
    }
   /* ethhw_init() is user-defined */
   /* use ip_input instead of ethernet_input for non-ethernet hardware */
   /* (this function is assigned to netif.input and should be called by the hardware driver) */
   netif_set_default(&netif);
   netif_set_up(&netif);
   grethif_display_phy(&netif);
   printf("done enumeration\n");
   return 0;
}

